<link rel="stylesheet" type="text/css" href="/css/userStyle.css" />
<script type="text/javascript" src="/js/change.js" language="javascript" ></script>
<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
<div class="page-title">
    <h1><?php echo $this->text_title;?> - <?php echo $this->content_search;?></h1>
</div>
<?php } else { ?>
<p><?php echo $this->text_title;?> - <?php echo $this->content_search;?></p>
<?php } ?>
<div class="line"><hr></div>
<div style="clear:both;"></div>
<style>
.highlight{
	background-color: yellow;
}
</style>
			<link rel="stylesheet" type="text/css" href="/css/insertQA.css" />
			<div id="pageindex">
				<div class="divright">
					<span class="titlets"><?php echo $this->text_sort;?></span>
					<select onchange="document.location.href='<?php echo $this->action_sort?>&sort='+this.value">
						<option value="ten_asc" <?php if($this->choose==1) echo 'selected="selected"'?>><?php echo $this->text_name_asc;?></option>
						<option value="ten_desc" <?php if($this->choose==2) echo 'selected="selected"'?>><?php echo $this->text_name_desc;?></option>
						<?php if($this->type==1){?>
						<option value="gia_asc" <?php if($this->choose==3) echo 'selected="selected"'?>><?php echo $this->text_price_asc;?></option>
						<option value="gia_desc" <?php if($this->choose==4) echo 'selected="selected"'?>><?php echo $this->text_price_desc;?></option>
						<?php }?>
						<option value="ngay_asc" <?php if($this->choose==5) echo 'selected="selected"'?>><?php echo $this->text_date_asc;?></option>
						<option value="ngay_desc" <?php if($this->choose==6) echo 'selected="selected"'?>><?php echo $this->text_date_desc;?></option>
					</select>
					<span class="titlets" style="margin-left: 120px;"><?php echo $this->text_show; ?></span>
					<input class="btn_change_type_show" type="button" onclick="document.location.href='<?php echo $this->action_show?>&show=1'" style="background-image: url('/images/<?php if($_GET["show"]==1) {?>icon_view_list_on.gif<?php } else {?>icon_view_list_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="document.location.href='<?php echo $this->action_show?>&show=3'" style="background-image: url('/images/<?php if($_GET["show"]==3) {?>icon_view_thumbnail_on.gif<?php } else {?>icon_view_thumbnail_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
					<input class="btn_change_type_show" type="button" onclick="document.location.href='<?php echo $this->action_show?>&show=2'" style="background-image: url('/images/<?php if($_GET["show"]==2) {?>icon_view_collapse_on.gif<?php } else {?>icon_view_collapse_off.gif<?php }?>'); border: none; width:19px;height:18px;margin-top:0;">
				</div>
			</div>
		
 		<?php 
		//echo $message;//test
		if(isset($_GET["show"]) && $_GET["show"]==1) // show dang detail  
		{ ?>
		<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
			<div style="clear:both;"></div>
			<div class="listing-type-list catalog-listing">
				<?php 	if(count($this->data_search)>0 && $this->type==1){ ?>
				<?php foreach ($this->data_search as $product) { ?>
				<div class="listing-item">
					<div class="product-image">
						<a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>">
							<img height="135" width="135"  src="<?php echo $product["avatar"] ?>">
						</a>
					</div>

					<div class="product-shop">
						<h5><a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $product["title"] ?></a></h5>
															
						<div class="price-box">
							<span id="product-price-16" class="regular-price">
								<strong><?php echo $this->price ?> </strong><span class="price">$<?php echo $product["price"] ?></span>
							</span>
									
						</div>

						<div class="clear"></div>
						<div class="description">
							<?php echo $product["short_description"] ?>
						</div>
						<p class="add-to">
							<a class="link-cart" href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $this->btndetail ?></a>
							<span class="pipe">|</span>
							<a href="#" onclick="addCart(<?php echo $product["thing_id"] ?>)"><?php echo $this->btnadd ?></a>
						</p>
					</div>
				</div>
				<?php }  } else {  if(count($this->data_search)>0) {?>
				<?php foreach ($this->data_search as $news) {  ?>
				<div class="listing-item">
					<div class="product-image">
						<a title="" href="/<?php echo $this->route;?>/detail?id=<?php echo $news["thing_id"] ?>">
							<img height="135" width="135" src="<?php echo $news["avatar"] ?>">
						</a>
					</div>

					<div class="product-shop">
						<h5><a href="/<?php echo $this->route;?>/detail?id=<?php echo $news["thing_id"] ?>"><?php echo $news["title"] ?></a></h5>
															
						<div class="price-box">
							<span id="product-price-16" class="regular-price">
								<strong><?php echo $news['update_date'] ?></span>
							</span>
									
						</div>

						<div class="clear"></div>
						<div class="description">
							<?php echo $news["short_description"] ?>...
							<a href="/<?php echo $this->route;?>/detail?id=<?php echo $news["thing_id"] ?>"><small><?php echo $this->text_detail; ?></small></a>
						</div>
					</div>
				</div>
				<?php	 } } else{ ?>
					<p style="clear:both;float:left; margin-left:15px;margin-top:15px;"><?php echo $this->text_nothing ?></p>
				<?php  } }?>
										
				<p class="txtli"><?php echo $this->pagination; ?></p>
			</div>
		<?php } else { ?>
		<link rel="stylesheet" type="text/css" href="/css/product_detail_show.css" />
		<script type="text/javascript" src="/js/jquery_elastic.js" language="javascript" ></script>
			
				<div class="detailProductShow">
							<?php 	if(count($this->data_search)>0 && $this->type==1){ ?>
								<h2></h2>
											<?php foreach ($this->data_search as $product) { ?>
							
							<div class="form">
								<div class="picture">
									<img src="<?php echo $product["avatar"] ?>" style="max-width:250px; max-height:150px">
									<h2><a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $product["title"] ?></a></h2>
									<div class="pro_col_bottom">
									<input type="button" name="btnDetails" style="background-image: url('../images/but_details2.png');color:white; border: none;text-align: center;float: left;" value="<?php echo $this->btndetail ?>" class="btnDetail" onclick="document.location.href='/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>'" <?php if($this->type!=1){?>style="margin-left: 50px;"<?php }?>/>
									<input type="button" name="Add" style="background-image: url('../images/but_addtocart2.png');color:white; border: none;text-align: center;margin:0px;padding:0px;float: right;" value="<?php echo $this->btnadd ?>" class="Add" onclick="addCart(<?php echo $product["thing_id"] ?>)" />
									</div>
								</div>
								<div class="content">
									<h2><?php echo $this->text_update ?> <?php echo $product['update_date'] ?></h2>
									<p><?php echo $product["short_description"] ?></p>
									<p style="clear:both;"><b><font color= "red"><?php echo $this->price ?> <?php echo $product["price"] ?>$</font></b></p>
								</div>
							</div>
							<?php }  } else {  if(count($this->data_search)>0) {?>
										<?php foreach ($this->data_search as $news) {  ?>
								
									<div class="picture2">
										<div class="picture_top2">
										</div>
										<div class="picture_content2">
										</div>
										<div class="picture_bottom2">
										</div>
										<img src="<?php echo $news["avatar"] ?>" width="180" height="130" alt="" class="imgpf2" style="max-width:230px; max-height:150px"/>
								
										<div class="contentnews2">
											<a href="/<?php echo $this->route;?>/detail?id=<?php echo $news["thing_id"] ?>"><h2><?php echo $news["title"] ?></h2></a><br style="line-height: 10px;"/>
											<p><?php echo $news["short_description"] ?> ...
											<a href="/<?php echo $this->route;?>/detail?id=<?php echo $news["thing_id"] ?>"><?php echo $this->text_detail; ?></a></p>
											<p style="margin-left: 200px;"><?php echo $news['update_date'] ?></p>
										</div>
									</div>
									<?php	 } } else{ ?>
									<p style="clear:both;float:left; margin-left:15px;margin-top:15px;"><?php echo $this->text_nothing ?></p>
									<?php  } }?>
									
							<p class="txtli"><?php echo $this->pagination; ?></p>
				</div>
		<?php } ?>
					
		<?php } 
		/////////////////////////////////////////////////////////////////////////
		//                                                                     //
		/////////////////////////////////////////////////////////////////////////
		
		else if(isset($_GET["show"]) && $_GET["show"]==2) // show dang short
		{ ?>
				<link rel="stylesheet" type="text/css" href="/css/category.css" />
				<link rel="stylesheet" type="text/css" href="/css/slideshow.css" />
				<div id="shortshow">
						
				 		<?php  
						if(count($this->data_search)>0){
						foreach ($this->data_search as $shortnew) { ?>
						<div id="show_img">	<a href="/<?php echo $this->route;?>/detail?id=<?php echo $shortnew["thing_id"] ?>"><img src="/images/plus-button.png" alt="" /></a></div>
						<div id="topic"><a href="/<?php echo $this->route;?>/detail?id=<?php echo $shortnew["thing_id"] ?>"><?php echo $shortnew["title"] ?></a>
									<a style="float:right;font-size:10px"> <?php echo $this->text_update ?>
												<?php  echo $shortnew['update_date'];  ?> </a>
						</div>
						
						<?php }} else echo $this->text_nothing ?>
						
					
					
				 </div>
				 <div class="loadpage"><?php echo $this->pagination; ?></div>
		<?php }
		/////////////////////////////////////////////////////////////////////////
		//                                                                     //
		/////////////////////////////////////////////////////////////////////////
		else // show dang thumb
		{ ?>
			<?php if($_SESSION['config_template']=='layoutmain_web2') { ?>
			<div style="clear:both;"></div>
			<link rel="stylesheet" type="text/css" href="/css/tooltip.css" />
			<script type="text/javascript" src="/js/jquery_elastic.js" language="javascript" ></script>
			<script type="text/javascript" src="/js/tooltip.js" language="javascript" ></script>
			<div class="listing-type-grid catalog-listing">
				<?php  
				$count=0;
				if(count($this->data_search)>0){
				foreach ($this->data_search as $product)
				{
					$count++;
					if($count==1)
						echo "<ol class='grid-row'>";
				?>
					<li class="item <?php if($count==4) echo "last"; ?>">
						<h5><a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('tt_<?php echo $product["thing_id"]?>')" onMouseout="hideddrivetip()"><?php echo $product["title"]?></a></h5>
						<p class="product-image">
								<a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('tt_<?php echo $product["thing_id"]?>')" onMouseout="hideddrivetip()">
									<img width="156" height="132" src="<?php echo $product['avatar']?>">
								</a>
						</p>
						<div class="price-box">
							<span id="product-price-16" class="regular-price">
						<?php if($this->type==1){?>
								<span class="price">$<?php echo $product["price"]?></span>
						<?php } ?>
							</span>		
						</div>
																			
						<div class="group_view">
							<p class="view_view" <?php if($this->type!=1){?>style="margin-left: 50px;"<?php }?> >
								<a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>"><?php echo $this->btndetail ?></a>
							</p>
							<?php if($this->type==1){?>
							<p class="view_addto"> 
								<button onclick="addCart(<?php echo $product["thing_id"] ?>)" class="form-button" type="button"><span><?php echo $this->btnadd ?></span></button>
							</p>
							<?php } ?>
							<div class="clear"></div>
						</div>
					</li>
					<!-- tooltip product -->
                    <div id="tt_<?php echo $product["thing_id"]?>" class="tooltip">
                        <div id="t_p_name">
                            <h3 class="p_name"><?php echo $product["title"]?></h3>
                        </div>
                        <div id="t_p_date">
                            <span class="p_date"><b><?php echo $this->cdate ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["created_date"])?></span>
                        </div>
                        <div id="t_p_status">
                            <span class="p_update"><b><?php echo $this->text_update ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["update_date"])?></span>
                        </div>
                        <div id="t_p_price">
                            <span class="p_price"><?php if($this->type==1){?><b><?php echo $this->price ?> </b><?php echo $product["price"]?> &nbsp; &nbsp;<?php }?> (<b><?php echo $this->view ?></b> <?php echo $product["views"]?>)</span>
                        </div>
                        <div id="t_p_picture" >
                        	<img src="<?php echo $product['avatar']?>" alt="" class="t_p_avatar"/>
                        </div>
                        <div id="t_pt_short_description" >
                        	<span class="p_short_description"><?php echo nl2br($product['short_description'])?></span>
                        </div>
					</div>
                    <!-- end tooltip product -->
				<?php 
					if($count==4)
					{
						$count=0;
						echo "</ol>";
					}
				}
				}
				?>
				<div class="loadpage"><?php echo $this->pagination; ?></div>
			</div>
			
			<?php } else { ?>
			<link rel="stylesheet" type="text/css" href="/css/tooltip.css" />
			<script type="text/javascript" src="/js/jquery_elastic.js" language="javascript" ></script>
			<script type="text/javascript" src="/js/tooltip.js" language="javascript" ></script>
			<div class="c_r_row">
				<?php  
				$count=0;
				if(count($this->data_search)>0){
				foreach ($this->data_search as $product) { $count++; ?>	
					<!--column product-->
					<div class="pro_col">
						<div class="pro_col_top" >
							<div class="pro_col_name">
								<a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('tt_<?php echo $product["thing_id"]?>')" onMouseout="hideddrivetip()"><h2><?php echo $product["title"]?></h2></a>
                            </div>
                            <div class="pro_col_img">
                            	<a href="/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>" onMouseover="ddrivetip('tt_<?php echo $product["thing_id"]?>')" onMouseout="hideddrivetip()"><img src="<?php echo $product['avatar']?>" alt="" class="pro_img"/></a>
							</div>
						</div>
						<div class="pro_col_content">
                        </div>
		  				<div class="pro_col_bottom">
		  					<div class="pro_col_price">
		  						<?php if($this->type==1){?><b class="pro_price">$<?php echo $product["price"]?></b><?php }?>
		  					</div>
							<div class="pro_col_button">
								<input type="button" name="btnDetails" style="background-image: url('../images/but_details2.png');color:white; border: none;text-align: center;" value="<?php echo $this->btndetail ?>" class="btnDetail" onclick="document.location.href='/<?php echo $this->route;?>/detail?id=<?php echo $product["thing_id"] ?>'" <?php if($this->type!=1){?>style="margin-left: 50px;"<?php }?>/>
								<?php if($this->type==1){?><input type="button" name="btnAdd" style="background-image: url('../images/but_addtocart2.png');color:white; border: none;text-align: center;margin-left:10px" value="<?php echo $this->btnadd ?>" class="btnAdd" onclick="addCart(<?php echo $product["thing_id"] ?>)"/><?php }?>
							</div>
						</div>
					</div><!--end column product-->
					
					<!-- tooltip product -->
                    <div id="tt_<?php echo $product["thing_id"]?>" class="tooltip">
                        <div id="t_p_name">
                            <h3 class="p_name"><?php echo $product["title"]?></h3>
                        </div>
                        <div id="t_p_date">
                            <span class="p_date"><b><?php echo $this->cdate ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["created_date"])?></span>
                        </div>
                        <div id="t_p_status">
                            <span class="p_update"><b><?php echo $this->text_update ?> </b><?php $dateint = new Util(); echo $dateint->change_int_to_date($product["update_date"])?></span>
                        </div>
                        <div id="t_p_price">
                            <span class="p_price"><?php if($this->type==1){?><b><?php echo $this->price ?> </b><?php echo $product["price"]?> &nbsp; &nbsp;<?php }?> (<b><?php echo $this->view ?></b> <?php echo $product["views"]?>)</span>
                        </div>
                        <div id="t_p_picture" >
                        	<img src="<?php echo $product['avatar']?>" alt="" class="t_p_avatar"/>
                        </div>
                        <div id="t_pt_short_description" >
                        	<span class="p_short_description"><?php echo nl2br($product['short_description'])?></span>
                        </div>
					</div>
                    <!-- end tooltip product -->
					
				<?php 
					if($count==3)
					{
						$count=0;
						echo"</div><div class='c_r_row' >";
					}
				}} else echo $this->text_nothing ?>	
				</div><!--end c_r_row-->
				
				<div class="loadpage"><?php echo $this->pagination; ?></div>
				<?php } ?>
		<?php } ?>
		<div style="clear: both;"></div>
